package com.kds.smarthome.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "smarthome")
public class SmartHomeConfig {
    private Security security = new Security();
    private IpLocation ipLocation = new IpLocation();
    
    @Data
    public static class Security {
        private Jwt jwt = new Jwt();
        private Login login = new Login();
        
        @Data
        public static class Jwt {
            private String secret = "your-default-secret-key";
            private long tokenValidityInSeconds = 86400; // 24小时
            private long tokenValidityInSecondsForRememberMe = 2592000; // 30天
        }
        
        @Data
        public static class Login {
            private int maxAttempts = 5; // 最大登录尝试次数
            private int lockDurationSeconds = 300; // 锁定时间（秒）
            private int captchaExpireSeconds = 300; // 验证码过期时间（秒）
        }
    }
    
    @Data
    public static class IpLocation {
        private boolean enable = false; // 是否启用IP定位
        private String url = "https://qifu-api.baidubce.com/ip/geo/v1/district"; // IP定位API地址
        private String paramName = "ip"; // IP参数名
        private int timeout = 3000; // 请求超时时间(毫秒)
    }
} 